﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing.Text;
using System.Drawing;
using System.Drawing.Drawing2D;
using Algorithms.Tools;
using System.Windows.Forms;

/*
 * TH07 Groep 10
 * ----------------------------------------------------------------------------------
 * Versie   Door        Commentaar
 * 0.1      Mike        Opzet en programmeer werk
 * 0.2      Luca        Optimalisatie code
 *                      Hernoemen variabelen en functies
 *                      overbodige code verwijderd 
 *                      crop image naar eigen tool classe verplaatst.
 *               
 */


namespace THO7AlgoritmTimerApplication
{
    class VisionAlgorith_OCR : VisionAlgorithm
    {
        private List<String> fontList;

        public List<String> FontList
        {
            get { return fontList; }
            set { fontList = value; }
        }

        public VisionAlgorith_OCR(String name) : base(name) { }

        public override System.Drawing.Bitmap DoAlgorithm(System.Drawing.Bitmap sourceImage)
        {
          
            OCR o = new OCR();
           
            o.Train(this.fontList.ToArray());
           
            
            Algorithms.Tools.Crop c = new Crop();
            VisionImage a = new VisionImage(sourceImage);

            VisionImage cropped = new Algorithms.Tools.VisionImage(c.run(a));
            char result = o.RecognizeChar(cropped);

            

            MessageBox.Show("recoginized: " + result);
          

            return cropped.Bitmap;
          
            return o.GetImg().Bitmap;
        }
    }
}